package com.example.springrestrepositories.respository;

import java.util.List;

import com.example.springrestrepositories.entity.Person;
import com.example.springrestrepositories.summary.PersonSummary;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.CrudRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.web.bind.annotation.RequestBody;

@RepositoryRestResource(collectionResourceRel = "people2", path = "people")
public interface PersonRepository extends PagingAndSortingRepository<Person, Long>, CrudRepository<Person,Long> {

  List<PersonSummary> findByLastName(@Param("name") String name);

  List<PersonSummary> findByFirstName(@Param("name") String name);

  void deleteByFirstNameAndLastName(@Param("firstName") String firstName, @Param("lastName") String lastName);

}